package com.gagakuai.engine.exception;


/*
 * Exception that is thrown when the Activiti engine discovers a mismatch between the
 * database schema version and the engine version.
 * <p>
 * The check is done when the engine is created in {@link ProcessEngineBuilder#buildProcessEngine()}.
 *
 * @author Tom Baeyens
 */
public class ActivitiWrongDbException extends ActivitiException {

    private static final long serialVersionUID = 1L;

    String libraryVersion;
    String dbVersion;

    public ActivitiWrongDbException(String libraryVersion, String dbVersion) {
        super("version mismatch: activiti library version is '" + libraryVersion + "', db version is " + dbVersion + " Hint: Set <property name=\"databaseSchemaUpdate\" to value=\"true\" or value=\"create-drop\" (use create-drop for testing only!) in bean processEngineConfiguration in activiti.cfg.xml for automatic schema creation");
        this.libraryVersion = libraryVersion;
        this.dbVersion = dbVersion;
    }

    /*
     * The version of the Activiti library used.
     */
    public String getLibraryVersion() {
        return libraryVersion;
    }

    /*
     * The version of the Activiti library that was used to create the database schema.
     */
    public String getDbVersion() {
        return dbVersion;
    }
}
